package com.shanjupay.merchant.service;

import com.shanjupay.common.util.QiniuUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

@Service
public class FileServiceImpl implements FileService {

    @Value("${oss.qiniu.accessKey}")
    String accessKey="";

    @Value("${oss.qiniu.secretKey}")
    String secretKey;

    @Value("${oss.qiniu.bucket}")
    String bucket;

    @Value("${oss.qiniu.qiniuUrl}")
    String qiniuUrl;

    @Override
    public String upload(byte[] bytes, String fileName) {
        String res = QiniuUtils.upload2qiniu(accessKey, secretKey, fileName, bucket, bytes);
        String downloadUrl=qiniuUrl+res;
        return downloadUrl;
    }
}
